package com.ruoyi.web.controller.production.graftingclip;

import java.util.List;

import com.ruoyi.common.annotation.PropertyInject;
import com.ruoyi.common.enums.InjectType;
import io.swagger.annotations.Api;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.production.domain.graftingclip.GraftingclipAmount;
import com.ruoyi.production.service.graftingclip.IGraftingclipAmountService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 嫁接夹量Controller
 *
 * @author ruoyi
 * @date 2021-07-12
 */
@RestController
@RequestMapping("/production/graftingclipAmount")
@Api(value = "嫁接夹量",tags = "嫁接夹量相关API")
public class GraftingclipAmountController extends BaseController
{
    @Autowired
    private IGraftingclipAmountService graftingclipAmountService;

    /**
     * 查询嫁接夹量列表
     */
    @PreAuthorize("@ss.hasPermi('production:graftingclipAmount:list')")
    @GetMapping("/list")
    public TableDataInfo list(GraftingclipAmount graftingclipAmount)
    {
        startPage();
        List<GraftingclipAmount> list = graftingclipAmountService.selectGraftingclipAmountList(graftingclipAmount);
        return getDataTable(list);
    }

    /**
     * 导出嫁接夹量列表
     */
    @PreAuthorize("@ss.hasPermi('production:graftingclipAmount:export')")
    @Log(title = "嫁接夹量", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(GraftingclipAmount graftingclipAmount)
    {
        List<GraftingclipAmount> list = graftingclipAmountService.selectGraftingclipAmountList(graftingclipAmount);
        ExcelUtil<GraftingclipAmount> util = new ExcelUtil<GraftingclipAmount>(GraftingclipAmount.class);
        return util.exportExcel(list, "嫁接夹量数据");
    }

    /**
     * 获取嫁接夹量详细信息
     */
    @PreAuthorize("@ss.hasPermi('production:graftingclipAmount:query')")
    @GetMapping(value = "/{graftingclipAmountId}")
    public AjaxResult getInfo(@PathVariable("graftingclipAmountId") Long graftingclipAmountId)
    {
        return AjaxResult.success(graftingclipAmountService.selectGraftingclipAmountById(graftingclipAmountId));
    }

    /**
     * 新增嫁接夹量
     */
    @PreAuthorize("@ss.hasPermi('production:graftingclipAmount:add')")
    @Log(title = "嫁接夹量", businessType = BusinessType.INSERT)
    @PostMapping
    @PropertyInject(type = InjectType.Insert)
    public AjaxResult add(@RequestBody GraftingclipAmount graftingclipAmount)
    {
        return toAjax(graftingclipAmountService.insertGraftingclipAmount(graftingclipAmount));
    }

    /**
     * 修改嫁接夹量
     */
    @PreAuthorize("@ss.hasPermi('production:graftingclipAmount:edit')")
    @Log(title = "嫁接夹量", businessType = BusinessType.UPDATE)
    @PutMapping
    @PropertyInject(type = InjectType.Update)
    public AjaxResult edit(@RequestBody GraftingclipAmount graftingclipAmount)
    {
        return toAjax(graftingclipAmountService.updateGraftingclipAmount(graftingclipAmount));
    }

    /**
     * 删除嫁接夹量
     */
    @PreAuthorize("@ss.hasPermi('production:graftingclipAmount:remove')")
    @Log(title = "嫁接夹量", businessType = BusinessType.DELETE)
	@DeleteMapping("/{graftingclipAmountIds}")
    public AjaxResult remove(@PathVariable Long[] graftingclipAmountIds)
    {
        return toAjax(graftingclipAmountService.deleteGraftingclipAmountByIds(graftingclipAmountIds));
    }
}
